import turtle

# 定义数字字典，每个数字都对应一个七段数码管的形状
digits = {
    '0': [(0, 50), (50, 50), (50, 0), (0, 0), (0, 50)],
    '1': [(25, 50), (25, 0)],
    '2': [(0, 50), (50, 50), (50, 25), (0, 25), (0, 0), (50, 0)],
    '3': [(0, 50), (50, 50), (50, 25), (0, 25), (50, 25), (50, 0), (0, 0)],
    '4': [(0, 50), (0, 25), (50, 25), (50, 50), (50, 0)],
    '5': [(50, 50), (0, 50), (0, 25), (50, 25), (50, 0), (0, 0)],
    '6': [(50, 50), (0, 50), (0, 0), (50, 0), (50, 25), (0, 25)],
    '7': [(0, 50), (50, 50), (50, 25), (25, 0)],
    '8': [(0, 50), (50, 50), (50, 0), (0, 0), (0, 50), (50, 50), (50, 25), (0, 25)],
    '9': [(50, 25), (0, 25), (0, 50), (50, 50), (50, 0), (0, 0)]
}

# 设置窗口
win = turtle.Screen()
win.setup(width=800, height=400)
win.title("2022年10月02日")

# 绘制日期
turtle.penup()
turtle.goto(-250, 0)
turtle.pendown()
turtle.pensize(5)
turtle.pencolor("red")
for digit in ['2', '0']:
    for segment in digits[digit]:
        turtle.goto(segment[0]-250, segment[1])
turtle.penup()
turtle.goto(-150, 0)
turtle.pendown()
for digit in ['1', '0']:
    for segment in digits[digit]:
        turtle.goto(segment[0]-150, segment[1])
turtle.penup()
turtle.goto(50, 0)
turtle.pendown()
for digit in ['0', '2']:
    for segment in digits[digit]:
        turtle.goto(segment[0]+50, segment[1])
turtle.penup()
turtle.goto(150, 0)
turtle.pendown()
for digit in ['0', '2']:
    for segment in digits[digit]:
        turtle.goto(segment[0]+150, segment[1])

# 隐藏turtle，保持窗口不关闭
turtle.hideturtle()
turtle.done()